package com.service;


import com.Dao.WordsDao;
import com.bean.Words;

import java.sql.SQLException;
import java.util.Date;
import java.util.List;

public class WordsService {
    WordsDao dao=new WordsDao();

    //添加
    public void addremark(Words words){
        try {
            dao.addWords(words);
        } catch (SQLException throwables) {
            throwables.printStackTrace();
            System.out.println("添加评论失败！！！");
        }
    }
    //删除
    public  void deletewords(int id){
        try {
            dao.deleteWords(id);
        } catch (SQLException throwables) {
            throwables.printStackTrace();
            System.out.println("删除评论失败！！！");
        }
    }
    //查看所有
    public List<Words> getAllwords(){
        List<Words> words=null;
        try {
            words= dao.getAllWords();
        } catch (SQLException throwables) {
            throwables.printStackTrace();
            System.out.println("查看失败！！！");
        }
        return words;
    }
    //获取发表时间
    public Date findPubTime(String content) throws SQLException {
        return dao.findPubTime(content);
    }

    //显示条数
    public int getWordCount() throws SQLException{
        return dao.findAllCount();
    }

    //
    public List<Words> findWordById(int id) throws SQLException{
        return dao.findWordsById(id);
    }
    //回复留言
}
